<script setup>
import { onLaunch } from '@dcloudio/uni-app';
onLaunch(() => {
	getWXStatusHeight();
	getTitleTop();
});
const getWXStatusHeight = () => {
	// 获取距上
	const barTop = uni.getSystemInfoSync().statusBarHeight;
	// 获取胶囊按钮位置信息
	const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
	// 获取导航栏高度
	const barHeight = menuButtonInfo.height + (menuButtonInfo.top - barTop) * 2;
	let barWidth = menuButtonInfo.width;
	uni.setStorageSync('capsule', { barTop, barHeight, barWidth });
};

const getTitleTop = () => {
	const sBarHeight = uni.getSystemInfoSync().statusBarHeight;
	let titleTop = 0;
	const menu = uni.getMenuButtonBoundingClientRect();
	titleTop = menu.top + (menu.height - sBarHeight) / 2; //顶部标题对齐
	uni.setStorageSync('systemInfo', { sBarHeight, titleTop });
};
</script>

<style lang="scss">
/*每个页面公共css */
page {
	background-color: #f6f6f6;
}
</style>
